package agngui.event;

import agngui.ui.Field;

/**
 * defines a FieldChangedEvent in the system
 * @author Ben Bloom
 * @author Phil Johnson
 */
public class FieldChangedEvent extends AGNEvent {

	/**
	 * the field being changed
	 */
	protected Field field;
	
	/**
	 * the new value for the field
	 */
	protected Double new_value;
	
	/**
	 * signals whether or not this event is an Undo event
	 */
	protected boolean is_undo;
	
	/**
	 * creates a new field changed event
	 * @param field The field being affected
	 * @param new_value The new value
	 * @param is_undo true if this is an undo event, false if it is not
	 */
	public FieldChangedEvent(Field field, Double new_value, boolean is_undo) {
		this.field = field;
		this.new_value = new_value;
		this.is_undo = is_undo;
	}
	
	/**
	 * Gives back the field that this event affects
	 * 
	 * @return The field associated with this event
	 */
	public Field getField() { return field; }
	
	/**
	 * Gives back the field's new value
	 * 
	 * @return The new value from this event
	 */
	public Double getNewValue() { return new_value; }
	
	/**
	 * Says whether or not this is an undo event
	 * 
	 * @return true if this is an undo event, false if it is not an undo event
	 */
	public boolean isUndo() { return is_undo; }
}
